<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="https://cdn.bootcdn.net/ajax/libs/vue/2.6.9/vue.min.js"></script>
</head>

<body>
    <div id="app">
        <mylogin>
            <template v-slot:header>
                <p> 我是头部</p>
                   
                

            </template>
            <template v-slot:footer>
                <p>
                    
                        我是尾部
               
                </p>
            </template>
        </mylogin>
    </div>
    <template id="demo">
        <div>
            <h1>
                <slot name="header"></slot>
            </h1>
            <h2>
                <slot name="footer"></slot>
            </h2>
        </div>
    </template>
    <style>
        div {
            width: 300px;
            height: 300px;
            background-color: red;
        }
    </style>
    <script>
        Vue.component("mylogin", {
            template: "#demo"
        })
        let vm = new Vue({
            el: "#app",
        })
    </script>
</body>

</html>